@extends('backend::layout')

@section('title', '编辑任课教师')

@section('content')

    <form method="post" id="check-form">
        {{ csrf_field() }}
        <input type="hidden" id="current_password" name="current_password">
        <input type="hidden" id="verify_password" name="verify_password">
        <div class="box box-primary">
            <div class="box-header with-border">
                <div class="col-lg-4">
                    <h3 class="box-title">
                        @if($logistics == 1)
                            编辑后勤教师
                        @else
                            编辑任课教师
                        @endif
                    </h3>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body pad-10">
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('tc_code')) has-error @endif">
                        <label class="control-label">{{ __('code') }}</label>
                        <input class="form-control" name="tc_code" type="text" placeholder="{{ __('code') }}" value="{{ old('tc_code')?:$teacher->tc_code }}">
                        @if($errors->has('tc_code'))
                            <span class="help-block">{{ $errors->first('tc_code') }}</span>
                        @endif
                    </div>
                </div>

                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('name')) has-error @endif">
                        <label class="control-label">{{ __('Username') }}</label>
                        <input class="form-control" name="name" type="text" placeholder="{{ __('Username') }}" value="{{ old('name')?:$teacher->name }}">
                        @if($errors->has('name'))
                            <span class="help-block">{{ $errors->first('name') }}</span>
                        @endif
                    </div>
                </div>

                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('phone')) has-error @endif">
                        <label class="control-label">手机号码</label>
                        <input class="form-control" name="phone" type="text" placeholder="手机号码" value="{{ old('phone')?:$teacher->phone }}">
                        @if($errors->has('phone'))
                            <span class="help-block">{{ $errors->first('phone') }}</span>
                        @endif
                    </div>
                </div>

                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('tl_code')) has-error @endif">
                        <label class="control-label">头衔：</label>
                        <div id="roles">
                            @if(!empty($level))
                                @foreach($level as $item)
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="tl_code[]"
                                                   @if((is_array(old('tl_code')) && in_array($item->tl_code, old('tl_code'))) || in_array($item->tl_code, $levelIds))
                                                       checked
                                                   @endif
                                                   value="{{ $item->tl_code }}
                                           ">
                                            {{ $item->name }}
                                        </label>
                                    </div>
                                @endforeach
                            @endif
                        </div>
                        @if($errors->has('tl_code'))
                            <span class="help-block text-danger">{{ $errors->first('tl_code') }}</span>
                        @endif
                    </div>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box-body -->
            <div class="box-footer m-b-2">
                <div class="col-lg-4">
                    <button class="btn btn-primary btn-sm" type="submit">
                        <i class="fa fa-check"></i> {{ __('Save') }}
                    </button>
                    &nbsp;&nbsp;&nbsp;
                    <a class="btn btn-default btn-sm" href="javascript:history.back(-1);">
                        <i class="fa fa-undo"></i> {{ __('Back') }}
                    </a>
                </div>
            </div>
            <!-- /.box-footer -->
        </div>
    </form>
@stop